﻿using System.Windows;
using System.Windows.Interactivity;

namespace Base.ModuleBase.Behaviors
{
    public class AutoHiddenBehavior:Behavior<UIElement>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
            AssociatedObject.Visibility= Visibility.Visible;
            AssociatedObject.Opacity = 0.1;
            AssociatedObject.MouseEnter += AssociatedObject_MouseEnter;
            AssociatedObject.MouseLeave += AssociatedObject_MouseLeave;
        }

        private void AssociatedObject_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            AssociatedObject.Opacity = 0.1;
        }

        private void AssociatedObject_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            AssociatedObject.Opacity = 1;
        }
    }
}
